<template>
  <div id="profile">
    <NavBar class="p-nav">
      <template v-slot:center>
        <div>个人中心</div>
      </template>
    </NavBar>
    <div class="info">
      <div class="info-avatar">
        <img src="@/assets/img/profile/user.png" alt />
        <div class="login-info" v-if="isLogin">
          <div>用户名：{{name}}</div>
          <div>id：{{id}}</div>
        </div>
        <div class="login-info" v-else>
          <div>您还没有登录</div>
          <div>
            <span>登录</span> |
            <span>注册</span>
          </div>
        </div>
      </div>
      <div class="account">
        <div class="info-item">
          <h2>0.00元</h2>
          <div>账户余额</div>
        </div>
        <div class="info-item">
          <h2>36</h2>
          <div>关注店铺</div>
        </div>
        <div class="info-item">
          <h2>16</h2>
          <div>收藏商品</div>
        </div>
      </div>
    </div>
    <div class="service">
      <div class="service-item">
        <div>
          <img src="@/assets/img/profile/gouwuche.png" alt />
        </div>
        <div>我的购物车</div>
      </div>
      <div class="service-item">
        <div>
          <img src="@/assets/img/profile/jifen.png" alt />
        </div>
        <div>我的积分</div>
      </div>
      <div class="service-item">
        <div>
          <img src="@/assets/img/profile/download.png" alt />
        </div>
        <div>下载</div>
      </div>
      <div class="service-item">
        <div>
          <img src="@/assets/img/profile/message.png" alt />
        </div>
        <div>我的消息</div>
      </div>
      <div class="service-item">
        <div>
          <img src="@/assets/img/profile/vip.png" alt />
        </div>
        <div>我的VIP</div>
      </div>
    </div>
  </div>
</template>

<script>
import NavBar from "@/components/common/navbar/NavBar.vue";

export default {
  name: "profile",
  components: {
    NavBar
  },
  data() {
    return {
      isLogin: true,
      name: "王草莓",
      id: 164325971
    };
  }
};
</script>

<style scoped>
.p-nav {
  background: var(--color-tint);
  color: #fff;
  border-bottom: 1px solid #fff;
}
.info-avatar {
  display: flex;
  padding: 20px 20px 20px 30px;
}
.info-avatar img {
  width: 48px;
  height: 48px;
  border: 3px solid #f1f1f1;
  border-radius: 50%;
  margin-right: 20px;
}
.login-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.login-info :last-child {
  padding-top: 8px;
}
.account {
  margin-top: 20px;
  padding-bottom: 20px;
  display: flex;
  text-align: center;
  border-bottom: 10px solid #f6f6f6;
}
.info-item {
  flex: 1;
}
.info-item h2 {
  margin-bottom: 5px;
  color: var(--color-tint);
}
.service {
  display: flex;
  flex-wrap: wrap;
}
.service-item {
  width: 33.3%;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
</style>